Add configurable query history recording via queryHistoryEnabled #800
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
This PR introduces a configurable option to enable/disable query history recording in Trino Gateway, addressing database performance bottlenecks and infrastructure cost concerns.
Problem
Currently, query history is always saved to the database, which creates several operational challenges:
Solution
Added a new configuration option queryHistoryEnabled in RoutingConfiguration that allows operators to:
Configuration
routing:
# Enable or disable query history recording to database (default: true)
queryHistoryEnabled: false # Set to false to disable query history recording
Default behavior: Query history is enabled by default (true) to maintain backward compatibility.
Benefits
Implementation Details
Core Changes
Test Coverage
Added comprehensive test suite covering all scenarios:
All tests pass: 290 tests run, 0 failures, 0 errors
Backward Compatibility
✅ Fully backward compatible
Files Changed
Production Code (3 files)
Test Code (5 files)
Follow-up
After this PR is approved and merged, a follow-up PR will be submitted to the Trino Gateway Helm Charts repository to expose this configuration option in the Helm values, making it easier for Kubernetes deployments to configure this setting.